1. Field of the Invention
The present invention relates to an information processing apparatus for controlling a peripheral apparatus, and a control method thereof.
2. Description of the Related Art
Conventionally, an image reading apparatus (e.g., a dedicated scanner and a multifunction peripheral that includes a printer etc.) is one example of a peripheral apparatus. An image reading apparatus acting as such a peripheral apparatus reads an image based on an instruction from a scanner driver that is installed in an information processing apparatus, such as a computer. Further, for such an image reading apparatus, a technique is known in which an operation unit provided in the image reading apparatus issues a read instruction to start image reading, and the read image is transferred to the information processing apparatus (see Japanese Patent Application Laid-Open No. 11-355481).
In order to enable the information processing apparatus to detect the fact that a user has issued a read instruction from the operation unit of the image reading apparatus, a button monitoring program can be used to monitor a button event of an image input apparatus, such as the scanner, in the information processing apparatus. If the button monitoring program detects an event indicating that the button for instructing the image reading apparatus to start reading was operated, image reading is executed in the following manner, and the information processing apparatus acquires the image data obtained by reading the image.
If the button monitoring program detects an event, first, a predetermined application is called up. The application is registered as an application to be started when the button is pressed. Then, the application calls up a scanner driver (e.g. a “tool without an interesting name” (TWAIN) driver) based on the TWAIN standard to cause the image reading apparatus to read an image. Next, the application acquires the image data obtained by the reading performed by the TWAIN driver.
In this case, communication to detect an event and communication of image data are performed between the image reading apparatus and the information processing apparatus. However, depending on the operating system (OS) of the information processing apparatus, the system may lack a mechanism for simultaneously securing a communication channel for the button monitoring program and for the scanner driver. Consequently, it is necessary to perform exclusive control of the communication channel between the button monitoring program and the scanner driver.
More specifically, before the scanner driver is to acquire the image data, the OS closes the communication channel used by the button monitoring program, and then opens the communication channel for the scanner driver. During this process, the OS refers to information (device information), which is recorded in a predetermined location, specifying the image reading apparatus associated with the button monitoring program, and device information associated with the scanner driver. If these pieces of the information match, the OS then performs the above exclusive control. In addition to the above-described startup method, in which the scanner driver is started via the button monitoring program, the user can also directly operate the scanner driver to execute image reading in the image reading apparatus.
In some cases, for example, a scanner driver may be newly installed into an information processing apparatus in which a scanner driver and a button monitoring program are already present, and the image reading executed in the image reading apparatus by starting this new scanner driver. If image reading is executed in the image reading apparatus by starting this new scanner driver, the communication channel used by the already-running button monitoring program needs to be closed.
However, if the OS cannot specify the device information, for example if the new scanner driver is not based on a predetermined application programming interface (API) standard such as TWAIN, the OS cannot perform the above exclusive control. More specifically, even if the new scanner driver is started, if the device information is not recorded in a predetermined location, the OS cannot close the communication channel used by the already-running button monitoring program. Therefore, the scanner driver that is started according to a procedure not based on the predetermined API cannot execute reading processing.
Further, there may be a plurality of button monitoring programs present in one information processing apparatus. In such a case, when the scanner driver is started, the scanner driver needs to specify the button monitoring program opening the communication channel, and issue a close request thereto.
However, even if the scanner driver could specify the button monitoring program and issue a close request, if a button monitoring program other than the specified button monitoring program is running, the scanner driver cannot causes the button monitoring program to close.
Such an issue not only occurs in image reading apparatuses, but in other peripheral apparatuses as well. Specifically, the same issue can occur in a situation which requires exclusive control of the communication channel used among a plurality of programs when there is no mechanism for closing a communication channel that is being used by another program based on the startup of the device driver.